package com.ssy.lingxi.after.sale.repository;

import com.ssy.lingxi.after.sale.entity.ReplaceGoodsDetailDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Set;

/**
 * 换货商品
 * @author 伍将
 * @date 2020/9/11
 * @version 2.0.0
 */
public interface ReplaceGoodsDetailRepository extends JpaRepository<ReplaceGoodsDetailDO, Long>, JpaSpecificationExecutor<ReplaceGoodsDetailDO> {

    /**
     * 根据退货id删除换货商品
     * @author 伍将
     * @date 2020/9/11
     * @param replaceId:
     * @return void
     **/
    void deleteAllByReplaceId(Long replaceId);

    /**
     * 根据换货id与是否退货条件检查是否存在换货商品
     * @author 伍将
     * @date 2020/9/15
     * @param replaceId:
     * @param isNeedReturn: 
     * @return java.lang.Boolean
     **/
    Boolean existsByReplaceIdAndIsNeedReturn(Long replaceId, Integer isNeedReturn);

    /***
     * 根据换货id查询换货商品
     * @author 伍将
     * @date 2020/9/22
     * @param replaceId:
     * @return java.util.List<com.ssy.lingxi.after.sale.entity.ReplaceGoodsDetailDO>
     **/
    List<ReplaceGoodsDetailDO> findByReplaceId(Long replaceId);
    /***
     * 根据换货id查询换货商品
     * @author 伍将
     * @date 2020/9/22
     * @param replaceIds:
     * @return java.util.List<com.ssy.lingxi.after.sale.entity.ReplaceGoodsDetailDO>
     **/
    List<ReplaceGoodsDetailDO> findByReplaceIdIn(Set<Long> replaceIds);
}
